# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=zsh-histdb-skim
pkgver=0.8.6
pkgrel=0
pkgdesc="A zsh histdb browser using skim"
url="https://github.com/m42e/zsh-histdb-skim"
# riscv64: textrels
# s390x: fails to build nix crate
arch="all !riscv64 !s390x"
license="MIT"
depends="zsh-histdb"
makedepends="
	cargo
	cargo-auditable
	sqlite-dev
	"
source="https://github.com/m42e/zsh-histdb-skim/archive/v$pkgver/zsh-histdb-skim-$pkgver.tar.gz"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	local plugname="${pkgname#zsh-}"

	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/

	install -D -m644 zsh-histdb-skim-vendored.zsh \
		"$pkgdir"/usr/share/zsh/plugins/$plugname/$plugname.plugin.zsh
}

sha512sums="
36e5ecc5b1b4c4fa04b07d54b1e319b5726b721cbaff480dfa2c5c78528b94d120dcc35f6878fd3c34e1f5afc3b77171cb9f3f67b7c21e093bff2a789579c90f  zsh-histdb-skim-0.8.6.tar.gz
"
